<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "user_collect".
 *
 * @property int $id
 * @property int $user_id 用户id
 * @property int $good_id 商品id
 * @property int $status 状态(0:未收藏 1:已收藏)
 * @property int $created_at 创建时间
 */
class UserCollect extends Base
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'user_collect';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['good_id', 'is_collect', 'status', 'created_at'], 'integer'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'user_id' => 'User ID',
            'good_id' => 'Good ID',
            'status' => 'Status',
            'created_at' => 'Created At',
        ];
    }

    public function getGood(){
      return $this->hasOne(Good::class, ['id' => 'good_id']);
    }
}
